package com.cloud.nacosprovider1.config;

import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author kangwen
 */
@Component
public class ServerConfig implements ApplicationListener<WebServerInitializedEvent> {
	private Integer port;

	@Override
	public void onApplicationEvent(WebServerInitializedEvent initializedEvent) {
		port = initializedEvent.getWebServer().getPort();
	}

	public Integer getPort() {
		return port;
	}
}
